<!doctype html>
<html>
<head>
</head>
<body>
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
?>

<!-- JavaScript -->
<script type="text/javascript" src="<?php echo base_url() ?>js/wufoo.js"></script>
<script type="text/javascript" src="<?php echo base_url() ?>js/zebra_datepicker.js"></script>
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>css/form/form.css" media="screen, tv, projection" title="Default" />
<link rel="stylesheet" href="<?php echo base_url() ?>css/zebra_datepicker_metallic.css" type="text/css">
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/chosen.css" media="screen, tv, projection" title="Default" />

<div id="container">
	<?
    	$value['legend'] = "Form Edit Data Peil Banjir";
		$value['info'] = "Form ubah data peil banjir";
		$value['act_form'] = "dpb/daftar/edit_dpb/".$idpeil_banjir;
	
	?>
	<?php echo form_open_multipart($value["act_form"],'class="wufoo" name="form_dpb"'); ?>
	<fieldset class="fieldset">
	<legend class="legend">
		<?= $value["legend"] ?> |
	</legend>
	
	<div class="info">
		<div><?php echo anchor(site_url('dpb/daftar'),img(array('src'=>'images/main/left.png','border'=>'0','alt'=>'')).'Kembali ke daftar data peil banjir','Menampilkan halaman Daftar Data Peil Banjir'); ?></div>
	</div>
	<!-- <div>
		<?php echo anchor(site_url('dpb/daftar'),img(array('src'=>'images/main/left.png','border'=>'0','alt'=>'')).'Kembali ke daftar data peil banjir','Menampilkan halaman Daftar Data Peil Banjir'); ?>
	</div> -->
 <!-- Konten -------------------------------------------------------------------------->
 <div id="contentform">
 <?$atrib='style="width:250px"; class="chzn-select"'?>
 <?$atrib_kcm='style="width:250px;" id="kecamatan" class="chzn-select"'?>
 <?$atrib_klr='style="width:250px;" id="kelurahan" class="chzn-select" data-allows-new-values="true"'?>
 <table border="0" width="100%" cellpadding="0" cellspacing="0">
 <tr valign="top">
 <td style="padding:10px;width:40%;">
    <ul>
        
        <li>
                    <label class="desc">Tahun *</label>
                        <div>
                                <? 
                                //list tahun
                                if(function_exists("date_default_timezone_set") and function_exists("date_default_timezone_get"))
                                    @date_default_timezone_set(@date_default_timezone_get());
                                 
                            $options['0'] = "-- Pilih Tahun --";
                            for($tahun=2000;$tahun<=date("Y")+5;$tahun++)
                            {
                                $options[$tahun] = $tahun;
                            }
                                echo form_dropdown('tahun',$options,$tahun,$atrib);    
                                ?>
                        </div>
                        
                    <p class="instruct">
                            Pilih Tahun Pada Kolom ini.         
                    </p>
                </li>
                <?php echo form_error('tahun'); ?>
		
				<li>
                    <label class="desc">Nama Pemohon *</label>
                        <div>
                             <input type="text" name="nama" class="new" value="<?php if(set_value('nama')!='') echo set_value('nama');else echo $nama;?>"/>
                        </div>
                    <p class="instruct">
                            Isikan Nama Pemohon
                    </p>
                </li>
                <?php echo form_error('nama'); ?>
				
				<li>
                    <label class="desc">Alamat Pemohon *</label>
                        <div>
                             <input type="text" name="alamat" class="new" value="<?php if(set_value('alamat')!='') echo set_value('alamat');else echo $alamat;?>"/>
                        </div>
                    <p class="instruct">
                            Isikan Alamat Pemohon
                    </p>
                </li>
                <?php echo form_error('alamat'); ?>
								
				<li>
                    <label class="desc">Tanggal Permohonan *</label>
                        <div>
                             <input type="text" name="tgl_permohonan" class="calendar" value="<?php if(set_value('tgl_permohonan')!='') echo set_value('tgl_permohonan');else echo $tgl_permohonan;?>"/>
                        </div>
                    <p class="instruct">
                            Tanggal permohonan surat
                    </p>
                </li>
                <?php echo form_error('tgl_permohonan'); ?>

                <li>
                    <label class="desc">Tanggal Ijin *</label>
                        <div>
                             <input type="text" name="tgl_perijinan" class="calendar" value="<?php if(set_value('tgl_perijinan')!='') echo set_value('tgl_perijinan');else echo $tgl_perijinan;?>"/>
                        </div>
                    <p class="instruct">
                            Tanggal perijinan surat
                    </p>
                </li>
                
                <?php echo form_error('tgl_perijinan'); ?>

                <li>
                    <label class="desc">No Ijin *</label>
                        <div>
                             <input type="text" name="no_ijin" class="new field" value="<?php if(set_value('no_ijin')!='') echo set_value('no_ijin');else echo $no_ijin;?>"/>
                        </div>
                    <p class="instruct">
                            Nomer Perijinan Surat
                    </p>
                </li>
                <?php echo form_error('no_ijin'); ?>
				
				<li>
                    <label class="desc">Lokasi *</label>
                        <div>
                             <input type="text" name="lokasi" class="new" value="<?php if(set_value('lokasi')!='') echo set_value('lokasi');else echo $lokasi;?>"/>
                        </div>
                    <p class="instruct">
                            Lokasi perijinan
                    </p>
                </li>
                <?php echo form_error('lokasi'); ?>
				
				<li>
                    <label class="desc">Kecamatan *</label>
                        <div>
                             <? $kecamatan = 0; if(set_value('kecamatan')!='') $kecamatan = set_value('kecamatan');
									echo form_dropdown('kecamatan', $kecamatan_options, $kecamatan,$atrib_kcm); ?>
                        </div>
                    <p class="instruct">
                            Lokasi kecamatan
                    </p>
                </li>
                <?php echo form_error('kecamatan'); ?>
				
				<li>
                    <label class="desc">Kelurahan *</label>
                        <div>
                             <? $kelurahan = 0; if(set_value('kelurahan')!='') $kelurahan = set_value('kelurahan');
									echo form_dropdown('kelurahan', $kelurahan_options, $kelurahan,$atrib_klr); ?>
                        </div>
                    <p class="instruct">
                            Lokasi kelurahan
                    </p>
                </li>
                <?php echo form_error('kelurahan'); ?>
								
				<li>
                    <label class="desc">Tinggi Air Maksimal (m) *</label>
                        <div>
                             <input type="text" name="tinggi_air" class="new" value="<?php if(set_value('tinggi_air')!='') echo set_value('tinggi_air');else echo $tinggi_air?>"/>
                        </div>
                    <p class="instruct">
                            Tinggi air maksimal dalam satuan meter
                    </p>
                </li>
                <?php echo form_error('tinggi_air'); ?>
				
				<li>
                    <label class="desc">Titik Tetap</label>
                        <div>
                             <input type="text" name="titik_tetap" class="new" value="<?php if(set_value('titik_tetap')!='') echo set_value('titik_tetap');else echo $titik_tetap?>"/>
                        </div>
                    <p class="instruct">
                            Titik tetap
                    </p>
                </li>
                <?php echo form_error('titik_tetap'); ?>
            </td>
				
		<td style="padding:10px; width:40%;">
    <ul>
        <li>
            <label class="desc">Foto Lokasi</label>
               <div class="foto_upl">
                <?php if($foto_lokasi!=""){?>
                <img src="<?php echo base_url()?>/uploads/dpb/<?php echo $foto_lokasi;?>">
                <?}else{?>
                <img src="<?php echo base_url();?>/images/main/no_image.jpg"><?}?>
               </div>
            
            <input type="file" name="foto_lks" size="20" class="file"/>
        </li>
        <br>
        <li>
            <label class="desc">Foto Sketsa</label>
               <div class="foto_upl">
               <?php if($foto_sketsa!=""){?>
                <img src="<?php echo base_url()?>/uploads/dpb/<?php echo $foto_sketsa;?>">
                <?}else{?>
                <img src="<?php echo base_url();?>/images/main/no_image.jpg"><?}?>
               </div>
            
            <input type="file" name="foto_sks" size="20" class="file"/>
        </li>
        <br>
        <li class="buttons">
          <input id="submit" type="submit" value="Simpan" />
          <input id="reset" type="reset" value="Reset" />
        </li>
    </ul>
    </td>
    </tr>
    </table>
</div>
</fieldset>
<?= form_close(); ?>

<script type="text/javascript" src="<?= base_url() ?>js/chosen.jquery.js"></script>
	<script type="text/javascript">
			$(".chzn-select").chosen({no_results_text: "Data yang dicari tidak ditemukan"});
		</script>
<script type="text/javascript">
$("#kecamatan").bind('change',function () 
{	
var prp = $("#kecamatan").val();

	$.ajax({
			url: "<?php echo base_url();?>index.php/dpb/kecamatan/get_ajax_kelurahan/",
			global: false,
			type: "POST",
			async: false,
			dataType: "html",
			data: "IDKECAMATAN="+ prp, //the name of the $_POST variable and its value
			success: function (response) {
				 var bahan = response;
				 
				 //document.getElementById('info_jd').innerHTML = pecah[0];
				 document.getElementById('kelurahan').innerHTML = response;
				 }
	});
	$("#kelurahan").trigger("liszt:updated");
	
	return false;
}
);

$(document).ready(function() {

    // assuming the controls you want to attach the plugin to 
    // have the "datepicker" class set
    $('input.calendar').Zebra_DatePicker();

 });
</script>

</div><!--container-->
</body>
</html>